package com.dkakunsi.monev.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="REALISASI_INDIKATOR")
public class RealisasiIndikator implements MonevEntity {
	private int id;
	private Indikator indikator;
	private int bulan;
	private double jumlah;
	private String foto;
	
	public RealisasiIndikator() { }

	public RealisasiIndikator(Indikator indikator, int bulan, double jumlah) {
		setIndikator(indikator);
		setBulan(bulan);
		setJumlah(jumlah);
	}
	
	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id", length=11, nullable=false)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="indikator", nullable=false)
	public Indikator getIndikator() {
		return indikator;
	}

	public void setIndikator(Indikator indikator) {
		this.indikator = indikator;
	}

	@Column(name="bulan", length=11, nullable=false)
	public int getBulan() {
		return bulan;
	}

	public void setBulan(int bulan) {
		this.bulan = bulan;
	}

	@Column(name="jumlah", nullable=false)
	public double getJumlah() {
		return jumlah;
	}

	public void setJumlah(double jumlah) {
		this.jumlah = jumlah;
	}

	@Column(name="foto", length=255, nullable=true)
	public String getFoto() {
		return foto;
	}
	
	public void setFoto(String foto) {
		this.foto = foto;
	}
}
